<?php 
include('connect.php');

$userName = $_GET['userName'];
$friend = $_GET['friend'];


$anfrage = "SELECT Username from tblusers WHERE Username like '$friend'";
$ergebnis = mysql_query($anfrage);
$anzahl = mysql_num_rows($ergebnis);

if($anzahl === 0) {
	$result = "error_user_not_found";
} else {
		$sql = mysql_query("SELECT ID FROM tblusers WHERE Username LIKE '$friend'");
		$id = mysql_result($sql, 0);
		$sql = mysql_query("DELETE FROM tblfriends WHERE ID LIKE '$id'");
		$sql = mysql_query("DELETE FROM tblfriends WHERE FriendID LIKE '$id'");
		$result = "success";
	}
echo $result;
?>